package com.aggregate.pay.saobei;

import com.aggregate.pay.saobei.bean.BarcodePayData;
import com.aggregate.pay.saobei.bean.BarcodePayResult;
import com.aggregate.pay.saobei.bean.JsPayData;
import com.aggregate.pay.saobei.bean.JsPayResult;
import com.aggregate.pay.saobei.bean.PayNotifyData;
import com.aggregate.pay.saobei.bean.PayNotifyResult;
import com.aggregate.pay.saobei.bean.QueryOrderData;
import com.aggregate.pay.saobei.bean.QueryOrderResult;
import com.aggregate.pay.saobei.bean.QueryRefundData;
import com.aggregate.pay.saobei.bean.QueryRefundResult;
import com.aggregate.pay.saobei.bean.RefundData;
import com.aggregate.pay.saobei.bean.RefundResult;
import com.aggregate.pay.saobei.bean.WapPayData;
import com.aggregate.pay.saobei.support.Client;
import com.aggregate.pay.saobei.support.Config;
import com.aggregate.pay.saobei.support.Factory;
import com.aggregate.pay.saobei.support.HttpClient;
import com.aggregate.pay.saobei.support.Merch;
import com.aggregate.pay.saobei.support.client.AuthOpenId;
import com.aggregate.pay.saobei.support.client.BarcodePay;
import com.aggregate.pay.saobei.support.client.JsPay;
import com.aggregate.pay.saobei.support.client.NotifyPay;
import com.aggregate.pay.saobei.support.client.QueryOrder;
import com.aggregate.pay.saobei.support.client.QueryRefund;
import com.aggregate.pay.saobei.support.client.Refund;
import com.aggregate.pay.saobei.support.client.WapPay;

/**
 * 扫呗支付接口工具类，相关配置和接口调用从此类开始
 * @author Moyq5
 * @date 2018年6月27日
 */
public abstract class SaobeiApiFactory {

	public static void config(Config config, HttpClient httpClient) {
		Factory.setConfig(config);
		Factory.setHttpClient(httpClient);
	}
	
	@SuppressWarnings("unchecked")
	public static Client<WapPayData, String> wapPayClient(Merch info) {
		return (Client<WapPayData, String>)Factory.getClient(WapPay.class, info);
	}

	@SuppressWarnings("unchecked")
	public static Client<PayNotifyData, PayNotifyResult> notifyPayClient(Merch info) {
		return (Client<PayNotifyData, PayNotifyResult>)Factory.getClient(NotifyPay.class, info);
	}

	@SuppressWarnings("unchecked")
	public static Client<QueryOrderData, QueryOrderResult> queryOrderClient(Merch info) {
		return (Client<QueryOrderData, QueryOrderResult>)Factory.getClient(QueryOrder.class, info);
	}

	@SuppressWarnings("unchecked")
	public static Client<RefundData, RefundResult> refundClient(Merch info) {
		return (Client<RefundData, RefundResult>)Factory.getClient(Refund.class, info);
	}
	
	@SuppressWarnings("unchecked")
	public static Client<QueryRefundData, QueryRefundResult> queryRefundClient(Merch info) {
		return (Client<QueryRefundData, QueryRefundResult>)Factory.getClient(QueryRefund.class, info);
	}

	@SuppressWarnings("unchecked")
	public static Client<JsPayData, JsPayResult> jsPayClient(Merch info) {
		return (Client<JsPayData, JsPayResult>)Factory.getClient(JsPay.class, info);
	}

	@SuppressWarnings("unchecked")
	public static Client<String, String> authOpenIdClient(Merch info) {
		return (Client<String, String>)Factory.getClient(AuthOpenId.class, info);
	}

	@SuppressWarnings("unchecked")
	public static Client<BarcodePayData, BarcodePayResult> barcodePayClient(Merch info) {
		return (Client<BarcodePayData, BarcodePayResult>)Factory.getClient(BarcodePay.class, info);
	}

}
